#ifndef __THREADCACHE_H__
#define __THREADCACHE_H__

#include <pthread.h>
#include "cacheCommon.h"

class threadCache
{
public:
    threadCache();
    ~threadCache();

    void* allocate(size_t size);
    void dellocate(void* ptr, size_t size);

    void* fetchFromCentral(size_t size);
    void releaseToCentral(freeList& fl, size_t size);

    static threadCache* createCacheIfNecessary();
    static threadCache* getThreadCache();
private:
    pthread_t tid_;
    
    threadCache* prev_;
    threadCache* next_;
    

    freeList free_list_[FREELISTNUM];
};



#endif